package com.lovetemperature.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name="stocks")
public class Stock {
	@Id
	@GeneratedValue
	private Long stockId;
	@ManyToOne(fetch=FetchType.LAZY)
	private Shop shop;
	@OneToOne
	@Cascade(value={CascadeType.SAVE_UPDATE,CascadeType.MERGE,CascadeType.DELETE})
	private GoodSet goodSet;
	@Temporal(TemporalType.DATE)
	private Date listDate;	//上架日期
	
	public Stock(){}
	public Long getStockId() {
		return stockId;
	}
	public void setStockId(Long stockId) {
		this.stockId = stockId;
	}
	public Shop getShop() {
		return shop;
	}
	public void setShop(Shop shop) {
		this.shop = shop;
	}
	public GoodSet getGoodSet() {
		return goodSet;
	}
	public void setGoodSet(GoodSet goodSet) {
		this.goodSet = goodSet;
	}
	public Date getListDate() {
		return listDate;
	}
	public void setListDate(Date listDate) {
		this.listDate = listDate;
	}
}
